import request from "@/config/request.js";

const categoryApi = {
  selectAll: "/category/selectAll",
  selectByPage: "/category/selectByPage",
  detail: "/category/selectById",
  insert: "/category/insert",
  update: "/category/update",
  remove: "/category/remove",
};

/**
 * 分类列表
 * @param {*} params
 * @returns
 */
export const selectAll = params => {
  return request.get(categoryApi.selectAll, { params });
};

/**
 * 分类列表
 * @param {*} params
 * @returns
 */
export const selectByPage = params => {
  return request.get(categoryApi.selectByPage, { params });
};

/**
 * 分类详情
 * @param {*} params
 * @returns
 */
export const detail = params => {
  return request.get(categoryApi.detail, { params });
};

/**
 * 添加分类
 * @param {*} params
 * @returns
 */
export const insert = params => {
  return request.post(categoryApi.insert, params);
};

/**
 * 更新分类
 * @param {*} params
 * @returns
 */
export const update = params => {
  return request.put(categoryApi.update, params);
};

/**
 * 删除分类
 * @param {*} params
 * @returns
 */
export const remove = params => {
  return request.delete(categoryApi.remove, params);
};
